#! /usr/bin/env python
# -*- coding: utf-8 -*-

# *************************************************************
#     Filename @  entry.py
#       Author @  Huoty
#  Create date @  2015-01-08 15:16:54
#  Description @  
# *************************************************************

import gtk

class PyApp(gtk.Window):
    def __init__(self):
        super(PyApp, self).__init__()

        self.set_title("Entry")
        self.set_size_request(250, 200)
        self.set_position(gtk.WIN_POS_CENTER)
        
        fixed = gtk.Fixed()
        self.label = gtk.Label("...")
        fixed.put(self.label, 60, 40)
        
        entry = gtk.Entry()
        entry.set_text("heee")
        entry.add_events(gtk.gdk.KEY_RELEASE_MASK)
        fixed.put(entry, 60, 100)
        entry.connect("key-release-event", self.on_key_release)

        self.connect("destroy", gtk.main_quit)
        self.add(fixed)
        self.show_all()

    def on_key_release(self, widget, event):
        self.label.set_text(widget.get_text())

# Script starts from here

if __name__ == "__main__":
    PyApp()
    gtk.main()
